
add_tag = (s, tagname) ->
    # document.doSomething
    e = document.createElement(tagname) # 创建h1标签
    t = document.createTextNode(s) # 创建文本
    e.appendChild(t)    # 文本加到标签里面
    document.body.appendChild(e)  # 文本加到body里面

resize = (s) ->
    img = document.getElementByTagName('img') # 获取图片标签
    # img.width = img.width * s;
    # img.height = img.height * s;
    # img.setAttribute('width',img.getAttribute('width').value * s);

print_text = (s) ->
    # document.doSomething
    tag = document.getElementById('hello') # 获取input标签
    t = tag.value
    add_tag(t, 'div')

# table = (s) -> {
#     # document.doSomething
#     table = document.createElement('table') # 创建table标签
#     th = document.createElement('th') # 创建表头
#     table.appendChild(th)    # 文本加到标签里面
#     td = document.createElement('td') # 创建表头
#     table.appendChild(td)    # 文本加到标签里面
#     document.body.appendChild(table)  # 文本加到body里面
# }

change_color = (event) ->
    title = document.getElementById('title')
    title.style.color = 'red'


recover_color = (event) ->
    title = document.getElementById('title')
    title.style.color = 'black'

document.onmouseenter = change_color
document.onmouseleave = recover_color
